﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using System.Web;
using Antu.WorkFlowFactory;
using System.Data;


namespace WebSys.UI.OfficeFlow
{
    public class CancelRSuspendSkin : MPBasicTemplate
    {
        FlowFactoryProvider _FlowFactoryProvider = (FlowFactoryProvider)ProviderService.ProviderServiceMange.GetProvider("FlowFactoryProvider");
        protected string UserId
        {
            get {  if (base.Page.Session["UserId"] != null) { return base.Page.Session["UserId"].ToString(); } else { return string.Empty; } }
            set { base.Page.Session["UserId"] = value; }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Button btnOK = (Button)FindControl("btnOK");
            btnOK.Click += new EventHandler(btnOK_Click);
        }
        private void CancelSuspend()
        {
            Literal Literal1 = (Literal)FindControl("Literal1");
            string iid = base.Page.Request["iid"];
            string wiid = base.Page.Request["wiid"];
            try
            {
                bool result = _FlowFactoryProvider.CancelApplySuspend(iid, wiid, UserId);
                if (result)
                    Literal1.Text = "<script type=\"text/jscript\">returnOk()</script>";
                else
                    throw new Exception("取消挂起过程出错");
            }
            catch (Exception eCancel)
            {
                Literal1.Text = "取消挂起申请出错！" + eCancel.Message;
            }

        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            CancelSuspend();
        }
        

    }
}


